package com.edmond.jyframe.fragments;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.edmond.jyframe.R;
import com.edmond.jyframe.adapter.GoodsCommentAdapter;
import com.edmond.jyframe.classes.GoodsComment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by edmond on 17-6-17.
 */

public class GoodsCommentFragment extends Fragment {

    private View view = null;
    private RecyclerView recyclerView = null;
    private GoodsCommentAdapter goodsCommentAdapter = null;
    private List<GoodsComment> goodsComments = new ArrayList<>();

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        super.onCreateView(inflater, container, savedInstanceState);
        view = inflater.inflate(R.layout.fragment_goods_comment,container,false);

        goodsComments.add(new GoodsComment());
        goodsComments.add(new GoodsComment());
        goodsComments.add(new GoodsComment());
        goodsComments.add(new GoodsComment());
        goodsComments.add(new GoodsComment());
        goodsComments.add(new GoodsComment());
        goodsComments.add(new GoodsComment());

        goodsCommentAdapter = new GoodsCommentAdapter(getActivity(),goodsComments);

        recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        recyclerView.setAdapter(goodsCommentAdapter);
        return view;
    }
}
